package com.tedu.day06mybatis.mapper;

import com.tedu.day06mybatis.pojo.Comment;
import com.tedu.day06mybatis.pojo.CommentVO1;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {
    @Insert("INSERT INTO comment(id,content,created,user_id,weibo_id) " +
            "VALUES(#{id},#{content},#{created},#{userId},#{weiboId})")
    int insert(Comment comment);
    @Delete("DELETE FROM comment WHERE id=#{id}")
    int delete(Integer id);
    @Update("UPDATE comment SET content=#{content},created=#{created},user_id=#{userId},weibo_id=#{weiboId} WHERE id=#{id}")
    int update(Comment comment);
    @Select("SELECT content,user_id userId FROM comment WHERE id=#{id}")
    CommentVO1 select(Integer id);
    @Select("SELECT id,content,created,user_id userId,weibo_id weiboId FROM comment")
    List<Comment> selectAll();




}
